<?php
$pdo  = new  PDO ( 'mysql:host=localhost;dbname=gaofei' , 'root' , 'root' );
$page=$_GET['page']??1;
$sel=$_GET['sel']??'';
$memc=memcache_connect('127.0.0.1',11211);
$key='page'.$page;
if ($sel!=''){
   $key=$key.$sel;
}
$arr=$memc->get($key);
if ($arr==''){
    echo '没有缓存';
    $limit=3;
    $start=($page-1)*$limit;
    $sql="select * from book  where book like '%$sel%' limit $start,$limit";
    $arr=$pdo->query($sql)->fetchAll(PDO::FETCH_ASSOC);
    $memc->set($key,$arr);
}
?>
<form method="get">
    <input type="text" name="sel">
    <input  type="submit" value="搜索">
</form>
<a href="list_jt.php?page=<?php echo $page?>">批量静态化</a>
<table border="1">
    <tr>
        <td>id</td>
        <td>book</td>
        <td>操作</td>
    </tr>
    <?php foreach($arr as $value) { ?>
        <tr>
            <td><?php echo $value['id']?></td>
            <td><?php echo $value['book']?></td>
            <td>
                <a href="zhanshi.php?id=<?php echo $value['id']?>">静态化</a>
            </td>
        </tr>
    <?php } ?>
</table>
<a href="show.php?page=<?php echo $page?>&news_title=<?php echo $book?>">首页</a>
<a href="show.php?page=<?php echo $page-1?>&book=<?php echo $book?>">上一页</a>
<a href="show.php?page=<?php echo $page+1?>&book=<?php echo $book?>">下一页</a>